<?php
$page      = $this->page;
$perPage   = $this->perPage;
$count     = $this->count;
$start     = ($page - 1) * $perPage + 1;
$end       = min($page * $perPage, $count);
$pageCount = (int)ceil($count / $perPage);
?>
<div class="row">
    <div class="col-md-5 col-sm-12">
        <div class="dataTables_info" id="sample_1_info" role="status"
             aria-live="polite"><?php echo 'Showing ' . $start . ' to ' . $end . ' of ' . $count . ' entries'; ?>
        </div>
    </div>
    <div class="col-md-7 col-sm-12">
        <div class="dataTables_paginate paging_bootstrap_full_number" id="sample_1_paginate">
            <ul class="pagination" style="visibility: visible;">
                <?php if($page !== 1) { ?>
                    <li class="prev <?php echo $page === 1 ? 'disabled' : ''; ?>">
                        <a href="<?php echo $page === 1 ? '#' : $this->uri(['page' => 1]); ?>" title="First">
                            <i class="fa fa-angle-double-left"></i>
                        </a>
                    </li>
                    <li class="prev <?php echo $page === 1 ? 'disabled' : ''; ?>">
                        <a href="<?php echo $page === 1 ? '#' : $this->uri(['page' => $page - 1]); ?>" title="Prev">
                            <i class="fa fa-angle-left"></i>
                        </a>
                    </li>
                <?php } ?>
                <?php if($page >= 3 && $pageCount - $page >= 0) { ?>
                    <li><a href="<?php echo $this->uri(['page' => $page - 2]); ?>"><?php echo $page - 2; ?></a></li>
                <?php } ?>
                <?php if($page >= 2 && $pageCount - $page >= 0) { ?>
                    <li><a href="<?php echo $this->uri(['page' => $page - 1]); ?>"><?php echo $page - 1; ?></a></li>
                <?php } ?>
                <li class="active"><a href="#"><?php echo $page; ?></a></li>

                <?php if($pageCount > 1 && $pageCount - $page >= 1) { ?>
                    <li><a href="<?php echo $this->uri(['page' => $page + 1]); ?>"><?php echo $page + 1; ?></a></li>
                <?php } ?>
                <?php if($pageCount > 2 && $pageCount - $page >= 2) { ?>
                    <li><a href="<?php echo $this->uri(['page' => $page + 2]); ?>"><?php echo $page + 2; ?></a></li>
                <?php } ?>
                <?php if($page !== $pageCount) { ?>
                    <li class="next <?php echo $page === $pageCount ? 'disabled' : ''; ?>">
                        <a href="<?php echo $page === $pageCount ? '#' : $this->uri(['page' => $page + 1]); ?>"
                           title="Next">
                            <i class="fa fa-angle-right"></i>
                        </a>
                    </li>
                    <li class="next <?php echo $page === $pageCount ? 'disabled' : ''; ?>">
                        <a href="<?php echo $page === $pageCount ? '#' : $this->uri(['page' => $pageCount]); ?>"
                           title="Last">
                            <i class="fa fa-angle-double-right"></i>
                        </a>
                    </li>
                <?php } ?>
            </ul>
        </div>
    </div>
</div>